/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.paises.business.impl;

import com.paises.business.PaisBo;
import com.paises.business.exception.PaisesNoEncontradoException;
import com.paises.dao.PaisDao;
import com.paises.domain.Pais;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author mjcali
 */
@Service
@Transactional
public class PaisBoImpl implements PaisBo {

    @Autowired
    private PaisDao paisDao;

    public PaisDao getPaisDao() {
        return paisDao;
    }

    public void setPaisDao(PaisDao paisDao) {
        this.paisDao = paisDao;
    }

    public ArrayList<Pais> buscarPaises() throws PaisesNoEncontradoException {
        ArrayList<Pais> paises = (ArrayList<Pais>) paisDao.buscarPaises();
        if (paises.isEmpty()) {
            throw new PaisesNoEncontradoException();
        }
        return paises;
    }
}
